package com.o.mj.service;

import com.o.mj.dao.WorkPersonMapper;
import com.o.mj.pojo.Company;
import com.o.mj.pojo.DataColleges;
import com.o.mj.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;


@Service
public class WorkPersonService {

    @Autowired
    WorkPersonMapper workPersonMapper;

    //工作人数
    public String workPerson() {
        return workPersonMapper.workPerson();
    }

    //总人数
    public String allPerson() {
        return workPersonMapper.allPerson();
    }

    //今日就业人数
    public String todayWorked() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date now = new Date();
        String time = sdf.format(now);
        return workPersonMapper.workTime(time);
    }

    //考公读研人数
    public String workBook() {
        return workPersonMapper.workType();
    }

    //各学院就业人数
    public List<DataColleges> Colleges() {
        List col = workPersonMapper.getColleges();
        return col;
    }

    //每天就业人数
    public List<DataColleges> getDate() {
        List dat = workPersonMapper.getDate();
        return dat;
    }

    //公司数
    public List<Company> getCompany() {
        return workPersonMapper.getCompany();
    }

    //保存头像
    public void picture(UserInfo userInfo){
        workPersonMapper.savePicture(userInfo);
    }

    //查找个人信息
    public UserInfo getPersonMessage(String userId){return workPersonMapper.getPersonMessage(userId);}
}
